//
//  XCPhoneSignInController.m
//  TTLestening
//
//  Created by dllo on 16/4/9.
//  Copyright © 2016年 dilo. All rights reserved.
//

#import "XCPhoneSignInController.h"
#import "XCPhoneRegisController.h"
#import <AVOSCloud.h>
#import "XCFirstViewController.h"
#import "XCLeftSetingController.h"
@interface XCPhoneSignInController ()

@property (weak, nonatomic) IBOutlet UITextField *userName;
@property (weak, nonatomic) IBOutlet UITextField *userPassWord;



@end

@implementation XCPhoneSignInController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}




- (IBAction)phoneRegis:(id)sender {
    
    XCPhoneRegisController *regis = [[XCPhoneRegisController alloc] init];
    [self.navigationController pushViewController:regis animated:YES];
    
}

- (IBAction)SignIn:(id)sender {
    
    
    [AVUser logInWithUsernameInBackground:self.userName.text password:self.userPassWord.text block:^(AVUser *user, NSError *error) {
        if (user != nil) {
            
          //  [self.navigationController pushViewController:success animated:NO];
            NSLog(@"登录成功");
            [[NSNotificationCenter defaultCenter] postNotificationName:@"degnlu" object:nil];
            XCFirstViewController *first = [[XCFirstViewController alloc] init];
            [self.navigationController pushViewController:first animated:YES];
            
        } else {
            
            NSLog(@"%@", error);
            
        }
    }];

    
    
}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
